package com.anders.springcloud.controller;

import com.anders.springcloud.pojo.Dept;
import com.anders.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class DeptConsumerController {

    // --feign方式--
    @Autowired
    private DeptClientService deptClientService = null;

    @PostMapping("/consumer/dept/add")
    public boolean addDeptF(Dept dept) {
        return deptClientService.addDept(dept);
    }

    @GetMapping("/consumer/dept/get/{id}")
    public Dept queryByIdF(@PathVariable("id") long id) {
        return deptClientService.queryById(id);
    }

    @GetMapping("/consumer/dept/all")
    public List<Dept> queryAllF() {
        return deptClientService.queryAll();
    }
}
